﻿//获取Url
function GetQueryString() {
    var result = location.search.match(new RegExp("[\?\&][^\?\&]+=[^\?\&]+", "g"));
    if (result == null) {
        return "";
    }
    for (var i = 0; i < result.length; i++) {
        result[i] = result[i].substring(1);
    }
    return result;
}
//获取URL某一参数
function GetQueryStringName(name) {
    if (name == null) {
        return "";
    }
    var result = location.search.match(new RegExp("[\?\&]" + name + "=([^\&]+)", "i"));
    if (result == null || result.length < 1) {
        return "";
    }
    return result[1];
}
//获取操作系统信息
function getOSAndBrowser() {
                var os = navigator.platform;
                var userAgent = navigator.userAgent;
                var info = "";
                var tempArray = "";
                if (os.indexOf("Win") > -1) {
                    if (userAgent.indexOf("Windows NT 5.0") > -1) {
                        info += "Windows 2000";
                    } else if (userAgent.indexOf("Windows NT 5.1") > -1) {
                        info += "Windows XP";
                    } else if (userAgent.indexOf("Windows NT 5.2") > -1) {
                        info += "Windows 2003";
                    } else if (userAgent.indexOf("Windows NT 6.0") > -1) {
                        info += "Windows Vista";
                    } else if (userAgent.indexOf("Windows NT 6.1") > -1 || userAgent.indexOf("Windows 7") > -1) {
                        info += "Windows 7";
                    } else if (userAgent.indexOf("Windows 8") > -1) {
                        info += "Windows 8";
                    } else {
                        info += "Other";
                    }
                } else if (os.indexOf("Mac") > -1) {
                    info += "Mac";
                } else if (os.indexOf("X11") > -1) {
                    info += "Unix";
                } else if (os.indexOf("Linux") > -1) {
                    info += "Linux";
                } else {
                    info += "Other";
                }
                info += "/";
                if (/[Ff]irefox(\/\d+\.\d+)/.test(userAgent)) {
                    tempArray = /([Ff]irefox)\/(\d+\.\d+)/.exec(userAgent);
                    info += tempArray[1];
                } else if (/MSIE \d+\.\d+/.test(userAgent)) {
                    tempArray = /MS(IE) (\d+\.\d+)/.exec(userAgent);
                    info += tempArray[1];
                } else if (/[Cc]hrome\/\d+/.test(userAgent)) {
                    tempArray = /([Cc]hrome)\/(\d+)/.exec(userAgent);
                    info += tempArray[1];
                } else if (/[Vv]ersion\/\d+\.\d+\.\d+(\.\d)* *[Ss]afari/.test(userAgent)) {
                    tempArray = /[Vv]ersion\/(\d+\.\d+\.\d+)(\.\d)* *([Ss]afari)/.exec(userAgent);
                    info += tempArray[3] + tempArray[1];
                } else if (/[Oo]pera.+[Vv]ersion\/\d+\.\d+/.test(userAgent)) {
                    tempArray = /([Oo]pera).+[Vv]ersion\/(\d+)\.\d+/.exec(userAgent);
                    info += tempArray[1];
                } else {
                    info += "Unknown";
                }
                return info;
            }